package com.abvnet.project.water.sewage.service;

import com.abvnet.common.utils.security.ShiroUtils;
import com.abvnet.common.utils.text.Convert;
import com.abvnet.project.water.sewage.domain.SewageIndex;
import com.abvnet.project.water.sewage.mapper.SewageIndexMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 污水指标 服务层实现
 * 
 * @author duj
 * @date 2019-07-02
 */
@Service
public class SewageIndexServiceImpl implements ISewageIndexService {
	@Autowired
	private SewageIndexMapper sewageIndexMapper;

	/**
     * 查询污水指标信息
     * 
     * @param indexId 污水指标ID
     * @return 污水指标信息
     */
    @Override
	public SewageIndex selectSewageIndexById(Long indexId) {
	    return sewageIndexMapper.selectSewageIndexById(indexId);
	}
	
	/**
     * 查询污水指标列表
     * 
     * @param sewageIndex 污水指标信息
     * @return 污水指标集合
     */
	@Override
	public List<SewageIndex> selectSewageIndexList(SewageIndex sewageIndex) {
	    return sewageIndexMapper.selectSewageIndexList(sewageIndex);
	}
	
    /**
     * 新增污水指标
     * 
     * @param sewageIndex 污水指标信息
     * @return 结果
     */
	@Override
	public int insertSewageIndex(SewageIndex sewageIndex) {
        sewageIndex.setCreateBy(ShiroUtils.getLoginName());
	    return sewageIndexMapper.insertSewageIndex(sewageIndex);
	}
	
	/**
     * 修改污水指标
     * 
     * @param sewageIndex 污水指标信息
     * @return 结果
     */
	@Override
	public int updateSewageIndex(SewageIndex sewageIndex) {
        sewageIndex.setUpdateBy(ShiroUtils.getLoginName());
	    return sewageIndexMapper.updateSewageIndex(sewageIndex);
	}

	/**
     * 删除污水指标对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteSewageIndexByIds(String ids) {
		return sewageIndexMapper.deleteSewageIndexByIds(Convert.toStrArray(ids));
	}
	
}